package com.tl.web.controller.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tl.app.domain.AppAccount;
import com.tl.app.domain.AppAccountAccess;
import com.tl.app.service.IAppAccountAccessService;
import com.tl.app.service.IAppAccountService;
import com.tl.app.service.IAppOrderService;
import com.tl.common.core.controller.BaseController;
import com.tl.common.core.domain.AjaxResult;
import com.tl.common.core.page.TableDataInfo;

/**
 * 用户账号
 * @author 15110
 *
 */
@RestController
@RequestMapping("/api/account")
public class ApiAccountController extends BaseController{
		
	  
	@Autowired
	private IAppAccountService appAccountService;
	
	@Autowired
	private IAppOrderService appOrderService;
	
	@Autowired
    private IAppAccountAccessService appAccountAccessService;
	  
	  
	  
	/**
     * 获取用户账户详细信息
     */
    @GetMapping("/getInfo")
    public AjaxResult getInfo(){
    	AppAccount aa=appAccountService.selectAppAccountById(getUserId());
    	if(aa!=null) {
    		aa.setDjsWeekPrice(appOrderService.selectAppOrderWeekClerkPrice(getUserId()));
    	}
        return success(aa);
    }
	
    
    /**
     * 查询用户提现列表
     */
    @GetMapping("/getAccesslist")
    public TableDataInfo getAccesslist(AppAccountAccess appAccountAccess){
        startPage();
        appAccountAccess.setUserId(getUserId());
        List<AppAccountAccess> list = appAccountAccessService.selectAppAccountAccessList(appAccountAccess);
        return getDataTable(list);
    }
	

}
